#include<stdio.h>
#include<string.h>
int main(){
  FILE* fp = NULL;
  fp = fopen("a.c","r");
  if(fp == NULL){
    printf("打开文件a.c失败,文件可能不存在");
  }

  FILE* fp1 = NULL;
  fp1 = fopen("b.c","w+");
  if(fp1 == NULL){
    printf("打开文件b.c失败");
  }

  FILE* fp2 = NULL;
  fp2 = fopen("c.c","a");
  if(fp2 == NULL){
    printf("打开文件c.c失败");
  }

  char buff[1024];
  int count = 0;
  // while(fread(buff,sizeof(buff),1,fp)>0){
  //   fwrite(buff,sizeof(buff),1,fp1);
  //   fwrite(buff,sizeof(buff),1,fp2);
  //   memset(buff,'\0',sizeof(buff));//清空字符数组
  // }
  // fwrite(buff,sizeof(buff),1,fp1);
  // fwrite(buff,sizeof(buff),1,fp2);

  while((count = fread(buff,sizeof(char),sizeof(buff),fp)) > 0){
    fwrite(buff,sizeof(char),count,fp1);
    fwrite(buff,sizeof(char),count,fp2);
  }

  return 0;

}
